﻿@model AdminViewModel
	<form class="layui-form" asp-controller="Administrator" asp-action="AdminEdit" method="post">
		<div class="layui-form-item">
			<label class="layui-form-label"><span class="c-red">*</span>管理员名</label>
			<div class="layui-input-block">
				@{
					if (Model.AdminID <= 0)
					{
						<input type="text" class="layui-input" asp-for="AdminName">
						<span asp-validation-for="AdminName" style="color:red;"></span>
					}
					else
					{
						<input type="text" class="layui-input layui-disabled" asp-for="AdminName" readonly="readonly">
						<span asp-validation-for="AdminName" style="color:red;"></span>
					}
				}
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label"><span class="c-red">*</span>密码</label>
			<div class="layui-input-block">
				@{
					if (Model.AdminID <= 0)
					{
						<input type="password" class="layui-input" asp-for="AdminPassword" data-val="true" data-val-required="密码不能为空">
						<span asp-validation-for="AdminPassword" style="color:red;"></span>
					}
					else
					{
						<input type="password" class="layui-input" id="AdminPassword" name="AdminPassword">
						<span style="color:red;">不修改请留空</span>
					}
				}
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label"><span class="c-red"></span>上级管理员</label>
			<div class="layui-input-block">
				<input type="text" class="layui-input" asp-for="ParentAdminName" />
				<span asp-validation-for="ParentAdminName" style="color:red;"></span>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label"><span class="c-red"></span>前台会员名</label>
			<div class="layui-input-block">
				<input type="text" class="layui-input" asp-for="UserName" />
				<span asp-validation-for="UserName" style="color:red;"></span>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">选项设置</label>
			<div class="layui-input-block">
				<input type="checkbox" asp-for="IsMultiLogin" lay-skin="primary" title="允许多人同时使用此帐号登录">
				<input type="checkbox" asp-for="IsModifyPassword" lay-skin="primary" title="允许管理员修改密码">
				@{
					if (Model.AdminID <= 0)
					{
						<input type="checkbox" asp-for="IsLock" lay-skin="primary" title="是否锁定">
					}
					else
					{
						<input type="checkbox" asp-for="IsLock" lay-skin="primary" title="是否锁定" class="layui-disabled" disabled="disabled">
					}
				}

			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">所属角色</label>
			<div class="layui-input-block">
				<select id="RoleIDs" class="layui-input" style="padding:0px;" asp-for="RoleIDs" lay-ignore></select>
				<span asp-validation-for="RoleIDs" style="color:red;"></span>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-input-block">
				<button type="submit" class="layui-btn layuiadmin-btn-list" lay-submit lay-filter="">保存</button>
				<button type="button" class="layui-btn layuiadmin-btn-list" onclick="layer_close()">取消</button>
				<input type="hidden" asp-for="AdminID" />
				<span style="color:red; font-size:18px;">@Html.ValidationSummary(true)</span>
			</div>
		</div>
	</form>
@section scripts{ 
<script type="text/javascript">
	$(function () {
		var result = "@Model.result";
		if (result == "ok") {
			layer_closeRefresh();
		}
		else
		{
			loadRolesAjax("RoleIDs", "@Model.RoleIDs", true);
		}
	});
</script>
}